import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
// 中间件
import { globalReqProcMidd } from './middleware/reqProc.midd';
// 响应拦截器
import { Response } from './common/response'
// 全局过滤器
import { HttpFilter } from './common/filter'
// ws适配器
import { WsAdapter } from './websocket/ws.adapter';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  // 全局前缀
  app.setGlobalPrefix('/nest-template')
  app.use(globalReqProcMidd);
  app.useGlobalInterceptors(new Response())
  app.useGlobalFilters(new HttpFilter())
  app.useWebSocketAdapter(new WsAdapter(app));

  await app.listen(3000);
}

bootstrap();
